<?php TPL::output('global/header.tpl.htm'); ?>

<div class="bd pbd">
	<!--right_nav_s-->
	<div class="tommy_rightDiv xBlog_tag enTryAside" id="default_topic_v2">
	<?php TPL::output('topic/related_topics.tpl.htm'); ?>
    
    <?php if ($this->user_id) { ?>
    <div class=" RightListDiv">
      <h3 class="h3">你的话题经验<em></em></h3>
      <p style="cursor:pointer" onclick="$(this).hide(); $('#topic_experience_editor').show();" id="topic_experience">
      	<span><?php if (! $this->topic_info['topic_experience']) { ?>你在 <?php echo $this->topic_info['topic_title']; ?> 话题中的经验<?php } else { ?><?php echo nl2br($this->topic_info['topic_experience']); ?><?php } ?></span>
      </p>
      
      <div class="default_area" style="display: none;" id="topic_experience_editor">
      <form action="topic/ajax/save_topic_experience/topic_id-<?php echo $this->topic_info['topic_id']; ?>" method="post">
      	<textarea class="default_textArea" name="experience_content"><?php echo $this->topic_info['topic_experience']; ?></textarea>
      	<p class="default_save"><a href="javascript:;" onclick="$('#topic_experience_editor').hide(); $('#topic_experience').show();">取消</a> <a href="javascript:;" onclick="ajax_post($('#topic_experience_editor form'), _topic_experience_editor__processer);" class="save_txt default_blue_but">保存</a></p>
      </form>
      </div>
    </div>
    <?php } ?>
    
    <div class="RightListDiv">
      <h3 class="h3">最佳回复者：<em></em></h3>

      <?php if (is_array($this->best_answer)){ ?>
      <?php foreach($this->best_answer AS $key => $val) { ?>
      <div class="porela default_liste"> 
        <?php if ($this->user_id != $val['uid'] AND $this->user_id) { ?><a href="javascript:void(0);" class="addtips fr<?php if ($val['user_info']['focus']) { ?> cur<?php } ?>" rel="<?php if ($val['user_info']['focus']) { ?>取消<?php } ?>关注" onclick="follow_people($(this), $(this).find('em'), <?php echo $val['uid']; ?>);"><em><?php if ($val['user_info']['focus']) { ?>取消<?php } ?>关注</em></a><?php } ?>
        <a rel="<?php echo $val['user_info']['uid']; ?>" onmouseover="eventsMouseM(this);" href="people/<?php echo $val['user_info']['user_name']; ?>"><?php echo $val['user_info']['user_name']; ?> </a> 
        <span class="s">回复了该话题 <b><?php echo $val['question_count'];?></b> 个问题，<br/>获得 <b><?php echo $val['agree_count'];?></b> 个赞同</span>
        <a class="facepostionImgs" href="people/<?php echo $val['user_info']['user_name']; ?>"><img src="<?php echo get_avatar_url($val['uid'],'mid',$val['avatar_file']); ?>" onmouseover="eventsMouseM(this);" rel="<?php echo $val['uid']; ?>"></a>
      </div>
      <?php } ?>
      <?php } ?>
    </div>
    
    <div class=" RightListDiv">
      <h3 class="h3"><span class="default_vor"><?php echo $this->topic_info['focus_count']; ?></span> 人关注了该话题</h3>
      <p class="default_GZ" id="focus_users"> </p>
    </div>
  </div>
  <!--right_nav_e--> 
  <!--left_nav_s-->
  <div class="contant_left pfo  DIS_top discussion_element">
    <ul class="ur default_anwsion">
      <li class="lr" id="topic_pic" alt="<?php echo $this->topic_info['topic_title']; ?>" style="background:url(<?php if ($this->topic_info['topic_pic']){ ?><?php echo get_setting('upload_url') . '/topic/' . str_replace(AWS_APP::config()->get('image')->topic_thumbnail['min']['w'].'_'.AWS_APP::config()->get('image')->topic_thumbnail['min']['h'], AWS_APP::config()->get('image')->topic_thumbnail['max']['w'].'_'.AWS_APP::config()->get('image')->topic_thumbnail['max']['h'], $this->topic_info['topic_pic']);?><?php } else { ?><?php echo G_STATIC_URL; ?>/common/topic-max-img.jpg<?php } ?>)">
      <?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><a class="editorTxt" id="topic_pic_uploader"  title="点击进入编辑此话题的图像" href="javascript:;">&nbsp;</a><?php } ?>
      </li>
      <li class="lsr">
        <p class="default_ed"><span id="topic_title"><b class="tx" val="<?php echo $this->topic_info['topic_title']; ?>"><?php echo $this->topic_info['topic_title']; ?></b> <?php if ($this->topic_info['topic_lock']) { ?><img class="lock" alt="lock" title="此话题已锁定" src="<?php echo G_STATIC_URL; ?>/css/default/img/lock.png"/><?php } ?></span> <?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><a href="topic/detail/<?php echo $this->topic_info['topic_id']; ?>" class="editorTxt">编辑</a><?php } ?>
        </p>
        <div class="xfo">
          <?php echo nl2br(cjk_substr($this->topic_info['topic_description'], 0, 128, 'UTF-8', '...')); ?>
          <p style="display:inline;"><?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><a href="topic/detail/<?php echo $this->topic_info['topic_id']; ?>" id="default_edite" class="editorTxt">编辑</a><?php } ?>
          </p>
        </div>
        
        <div class="default_SZ default_xfo_txt"><a href="topic/detail/<?php echo $this->topic_info['topic_id']; ?>" class="default_blue_but cur">话题详情</a> <?php if ($this->user_id) { ?><a  class="default_blue_but<?php if ($this->topic_info['has_focus']) { ?> cur <?php } ?>" href="javascript:;" onclick="focus_topic($(this), $(this), <?php echo $this->topic_info['topic_id']; ?>); return false;"><?php if ($this->topic_info['has_focus']) { ?>取消<?php } ?>关注</a><?php } ?>
        </div>
      </li>
    </ul>
  </div>
  <div class="contant_left readns_discus dis_ListEntry index">
    <h2 class="c_title">
      <ul class="default_question">
        <li><a onclick="elementClickEvent.letter.default_question(this,0,'');" class="cur" href="javascript:;">所有问题<span class="default_nums"><?php echo $this->topic_info['discuss_count'];?></span></a></li>
       
        <li><a onclick="elementClickEvent.letter.default_question(this,1,'');" href="javascript:;">等待回复<span class="default_nums"><?php echo $this->no_answer_question_count; ?></span></a></li>
		
<li><a onclick="elementClickEvent.letter.default_question(this,2,'');" href="javascript:;">最佳讨论<span class="default_nums"><?php echo $this->best_question_count; ?></span></a></li>	
      </ul>
    </h2>
    <div id="layer_0">
      <div id="c_all_list">
        <p style="padding: 15px 0" align="center"><img src="<?php echo G_STATIC_URL; ?>/common/loading_b.gif" alt="" /></p>
      </div>
      <div class="moreDiv" id="bp_all_more"><a href="#" class="mores">更多<em></em></a></div>
    </div>
    <div id="layer_1" class="hide">
      <div id="c_noanswer_list">
        <p style="padding: 15px 0" align="center"><img src="<?php echo G_STATIC_URL; ?>/common/loading_b.gif" alt="" /></p>
      </div>
      <div class="moreDiv" id="bp_noanswer_more"><a href="#" class="mores">更多<em></em></a></div>
    </div>
<div id="layer_2" class="hide">
      <div id="c_best_question_list">
        <p style="padding: 15px 0" align="center"><img src="<?php echo G_STATIC_URL; ?>/common/loading_b.gif" alt="" /></p>
      </div>
      <div class="moreDiv" id="bp_best_question_more"><a href="#" class="mores">更多<em></em></a></div>
    </div>	
  </div>
  <!--left_nav_e--> 
</div>

<script type="text/javascript">
	var TOPIC_ID = '<?php echo $this->topic_info['topic_id']; ?>';	
</script>

<script src="<?php echo G_STATIC_URL; ?>/js/topic.js"></script>

<?php TPL::output('global/footer.tpl.htm'); ?>